Drawings are used to visually express ideas on the web, in print or in other media. Drawings can be created and edited in software using various drawing applications. A typical drawing includes a plurality of paths that form regions, each of which might be filled with a color. Sometimes a region is not completely bounded by paths on all sides. For example, there may be a gap between two of the paths that enclose the region. Such gaps may not have been intended by the user. Some drawing applications search for gaps and close the gaps with a line when the region is filled. For example, a paint bucket tool could be used to fill the enclosed region, and the gaps are closed to prevent the paint from “leaking” out of the region. Existing gap detection methods include searching for candidate gaps using a small stamp, such as described by Gangnet (M. Gangnet, Automatic Gap Closing for Freehand Drawing, Siggraph (1994) Technical Sketch Submission), which is hereby incorporated by reference. Such methods can be computationally intensive and time consuming. An improved method of gap detection is needed.